package com.ifp.weixin.MessageMng.Service.impl;

import java.util.List;

import javax.annotation.Resource;
import javax.annotation.Resources;

import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import com.ifp.weixin.MessageMng.Dao.req.LocationMessageDao;
import com.ifp.weixin.MessageMng.Message.req.ReqLocationMessage;
import com.ifp.weixin.MessageMng.Service.LocationMessageService;
@Service("locationMessageService")
public class LocationMessageServiceImpl implements LocationMessageService {
	
	private LocationMessageDao locationMessageDao;
	
	public ReqLocationMessage GetMaxLocationMessage(String fromUserName) {
		// TODO Auto-generated method stub
		long id = locationMessageDao.getMaxIdFromUser(fromUserName);
		return locationMessageDao.loadById(id);
	}

	public void add(ReqLocationMessage u) throws Exception {
		// TODO Auto-generated method stub
		System.out.print("LocationMessageServiceImpl.add");
		locationMessageDao.save(u);
	}

	public List<ReqLocationMessage> getLocationMessages() {
		// TODO Auto-generated method stub
		return this.locationMessageDao.getLocations();
	}

	public ReqLocationMessage loadById(int id) {
		// TODO Auto-generated method stub
		return this.locationMessageDao.loadById(id);
	}

	public LocationMessageDao getLocationMessageDao() {
		return locationMessageDao;
	}
	

	@Resource(name="locationMessageDao")
	public void setLocationMessageDao(LocationMessageDao locationMessageDao) {
		this.locationMessageDao = locationMessageDao;
	}

}
